/*
 * @lc app=leetcode.cn id=459 lang=cpp
 *
 * [459] 重复的子字符串
 */

// @lc code=start
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
    bool repeatedSubstringPattern(string s)
    {
        for (int end = 1; end <= s.size() / 2; end++)
        {
            if (s.size() % end == 0)
            {
                bool flag = true;
                for (int i = end; i < s.size() && flag; i += end)
                {
                    for (int j = 0; j < end && flag; j++)
                    {
                        flag = s[j] == s[i + j];
                    }
                }
                if(flag) return true;

            }
        }
        return false;
    }
};
// @lc code=end
